/*
 * @Author: Joker
 * @Date: 2017-11-28 12:19:24
 * @Last Modified by: Joker
 * @Last Modified time: 2018-01-03 16:44:05
 */
import request from '../lib/request';

//系统参数
export const baseConfig = {

  /**
   * 获取消息类型
   */
  messageTypeList: param => request.get('/base/messageType'),
  /**
   * 上传图片
   */
  upLoad: param => request.fileUpload('/files/upload', param),

};
//登录
export const login = {
  /**
   * 获取消息列表
   */
  login: param => request.post('/users/login', param),
  logout: () => request.get('/users/logout'),
  /**
   * 根据人员ID获取对应权限的部门
   */
  getDeptByUserId: () => request.get('/users/depts'),
  /**
   * 根据人员ID获取对应权限的实体部门
   */
  getRealDeptByUserId: () => request.get('/users/depts/real'),

  /**
   * 获取当前用户的权限
   */
  getUserPowers: () => request.get('/roles/role'),
  /**
   * 获取角色列表
   */
  getRolesList: () => request.get('/roles/list'),
  /**
   * 获取角色树形列表
   */
  getRolesTree: param => request.get('/roles/tree'),
  /**
   * 获取前角色可见的权限可选项
   */
  getMenuList: () => request.get('/roles/getAllPermission'),
  /**
   * 获取当前用户获取权限Id
   */
  getRoleList: () => request.get('/roles/permissionList'),
  /**
   * 修改密码
   */
  updatePass: param => request.post('/users/password/new', param),
};
//首页
export const homePage = {
  /**
   * 获取消息列表
   */
  getUserInfo: () => request.get('/users/getUserByWebToken'),
  /**
   * 获取流程信息
   */
  getFlowInfo: param => request.get('/constructionbase/wholeflows/show/' + param),

};
//消息管理
export const messageManagement = {

  /**
   * 发送消息
   */
  sendMessage: param => request.post('/message/add', param),

  /**
   * 获取消息列表
   */
  messageList: param => request.post('/message/list', param),

  /**
   * 消息详情
   */
  detailMessage: param => request.get('/message/details/' + param),
  /**
   * 删除消息
   */
  deleteMessage: param => request.get('/message/deleteMessage/' + param)
};
//设备管理
export const deviceManagement = {
  /**
   * 获取表格数据
   */
  getTableData: param => request.post('/device/selectDevice', param),
  /**
   * 通过id删除数据
   */
  delTableData: param => request.get('/device/deleteDevice/' + param),
  /**
   * 新增设备
   */
  addTableData: param => request.post('/device/insertDevice', param),
  /**
   * 新增设备
   */
  updateTableData: param => request.post('/device/updateDevice', param),
  /**
   * 查询设备状态
   */
  getDeviceStatus: param => request.get('/device/status'),
};
//车辆管理
export const vehicleManagement = {
  /**
   * 获取表格数据
   */
  getTableData: param => request.post('/vehicle/selectVechicle', param),
  /**
   * 通过id删除数据
   */
  delTableData: param => request.get('/vehicle/deleteVechicle/' + param),
  /**
   * 新增车辆
   */
  addTableData: param => request.post('/vehicle/insertVechicle', param),
  /**
   * 新增车辆
   */
  updateTableData: param => request.post('/vehicle/updateVechicle', param),
  /**
   * 查询可绑定的设备
   */
  bindDevices: param => request.get('/device/getBindDevices'),

};
//不停航施工
export const construction = {
  /**
   * 获取可用人员列表
   */
  getPersons: param => request.get('/depts/virDept/user/' + param),

  /** 获取指定项目部的角色为施工单位人员 */
  getExePersons: param => request.get('/depts/virDept/exeUser/'+param),

  /**
   * 获取流程列表
   */
  getTodayHistory: param => request.post('/constructionbase/flow/todayandhistory/show', param),
  /**
   * 获取交接单列表
   */
  getTodayHistorySubmit: param => request.post('/constructionbase/succeed/todayandhistory/show', param),
  /**
   * 获取交接单详细
   */
  getSubmitInfo: param => request.get('/constructionbase/succeed/info/' + param),
  /**
   * 创建交接单
   */
  createSubmit: param => request.get('/constructionbase/show/todayflow/' + param),
  /**
   * 获取昨天流程的明日计划作为今日的今日计划
   */
  getTodayPlan: param => request.get('/constructionoperation/todaycontent/show/' + param),
  /**
   * 新建流程
   */
  createNewOne: param => request.post('/constructionbase/newflow', param),
  /**
   * 查询流程详细
   */
  getDetail: param => request.get('/constructionbase/wholeflow/show/' + param),
  /**
   * 指挥部确认 等待审批
   */
  entryConfirmation: param => request.get('/constructionoperation/approach/confirmation/' + param),
  /**
   * 摆放标识
   */
  putmark: param => request.get('/constructionoperation/approach/putmark/setting/' + param),
  /**
   * 确认人员设备
   */
  concentrate: param => request.get('/constructionoperation/concentrate/setting/' + param),
  /**
   * 施工结束
   */
  applyEnd: param => request.get('/constructionoperation/construction/end/' + param),
  /**
   * 手动结束
   */
  manualEnd: param => request.get('/constructionoperation/construction/manualend/' + param),

  /**
   * 紧急事件
   */
  urgent: param => request.post('/constructionoperation/emergencyevents/setting', param),
  /**
   * 安检确认
   */
  safe: param => request.get('/constructionoperation/enterconstruction/confirmation/' + param),
  /**
   * 确认通知
   */
  noticeConfirm: param => request.get('/constructionoperation/project/confirmation/' + param),
  /**
   * 施工计划
   */
  plan: param => request.post('/constructionoperation/plan/setting', param),
  /**
   * 监理单位确认施工计划
   */
  watchConfirm: param => request.get('/constructionoperation/plan/supervisor/confirmation/' + param),
  /**
   * 施工风险
   */
  preparation: param => request.post('/constructionoperation/preparation/setting', param),
  /**
   * 复查安检确认
   */
  reviewSafe: param => request.get('/constructionoperation/review/confirmation/' + param),
  /**
   * 复查
   */
  review: param => request.get('/constructionoperation/review/setting/' + param),
  /**
   * 交接单提交
   */
  submitDoc: param => request.post('/constructionbase/succeed/setting', param),

  /**
   * 查询当前用户是否有新增流程的权限
   */
  checkAddPermission: () => request.get('/constructionbase/add/permission'), 
};
//部门管理
export const departmentManagement = {
  /**
   * 新建部门
   */
  createNewOne: param => request.post('/depts/add', param),
  /**
   * 修改部门
   */
  update: param => request.post('/depts/update', param),
  /**
   * 删除部门
   */
  del: param => request.get('/depts/delete/' + param),
  /**
   * 获取部门下人员
   */
  getUsers: param => request.get('/depts/users/' + param),

};
//用户管理
export const userManagement = {
  /**
   * 获取部门下人员
   */
  getPersonByDept: param => request.post('/depts/users/', param),
  /**
   * 获取人员的部门
   */
  getDeptByPerson: param => request.get('/users/dept/' + param),
  /**
   * 获取部门下人员
   */
  add: param => request.post('/users/add', param),
  /**
   * 修改人员信息
   */
  update: param => request.post('/users/update', param),
  /**
   * 删除下人员
   */
  del: param => request.get('/users/delete/' + param),

  upLoad:"users/upload"

};
//角色管理
export const roleManagement = {
  /**
   * 新增角色
   */
  createNewOne: param => request.post('/roles/add', param),
  /**
   * 修改角色
   */
  update: param => request.post('/roles/update', param),
  /**
   * 删除角色
   */
  del: param => request.get('/roles/delete/' + param),
  /**
   * 获取当前角色已拥有的权限Id
   */
  getRoleList: param => request.get('/roles/getPermissionList/' + param),
  /**
   * 保存当前角色已拥有的权限Id
   */
  save: param => request.post('/roles/save', param),


};
//用户组管理
export const userGroupManagement = {
  /**
   * 新增用户组
   */
  getUserGroup: () => request.get('/userGroup/getUserGroups'),
  /**
   * 新增用户组
   */
  createNewOne: param => request.post('/userGroup/insertUserGroups', param),
  /**
   * 获取当前用户组下的用户
   */
  getGroupUsers: param => request.post('/userGroup/getUserListByUserGroupId', param),
  /**
   * 删除当前用户组下的用户
   */
  delGroupUser: param => request.post('/userGroup/deleteUser', param),
  /**
   * 删除当前用户组
   */
  delGroup: param => request.get('/userGroup/deleteUserGroup/' + param),
  /**
   * 修改当前用户组基本信息
   */
  updateGroup: param => request.post('/userGroup/updateUserGroups', param),
  /**
   * 新增当前用户组下的人员
   */
  addGroupUser: param => request.post('/userGroup/addUser', param),
};
//项目管理
export const projectManagement = {
  /**
   * 查询项目
   */
  getProList: () => request.get('/projects/gets'),
  /**
   * 新增项目
   */
  add: param => request.post('/projects/add', param),
  /**
   * 修改项目
   */
  update: param => request.post('/projects/update', param),
}
//获取天气
export const weather = param => request.get('/weather/gets/'+param);
//用户导入
export const userUpload = param => request.fileUpload('',param)